#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include"5.28RedBlackTree.h"
namespace sqy
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RedBlackTree<K, K, SetKeyOfT>::iterator iterator;
		typedef typename RedBlackTree<K, K, SetKeyOfT>::reverse_iterator reverse_iterator;

		reverse_iterator rbegin()
		{
			return _t.rbegin();
		}
		reverse_iterator rend()
		{
			return _t.rend();
		}
		iterator begin()
		{
			return _t.begin();
		}
		iterator end()
		{
			return _t.end();
		}
		
		pair<iterator, bool> Insert(const K& key)
		{
			return _t.Insert(key);
		}
		iterator find(const K& key) const
		{
			return _t.find(key);
		}
	private:
		RedBlackTree<K, K, SetKeyOfT> _t;
	};
	void test_set1()
	{
		set<int>s;
		s.Insert(5);
		s.Insert(3);
		s.Insert(2);
		s.Insert(1);
		set<int>::reverse_iterator cit = s.rbegin();
		while (cit != s.rend())
		{
			cout << *cit << endl;
			++cit;
		}
	

	}
}